<?php

/**
 * Skeleton subclass for representing a row from the 'invoices' table.
 *
 *
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package    propel.generator.damages
 */
class DamagesInvoices extends DamagesBaseInvoices {

  public function save(PropelPDO $con = null) {
    $this->setLogs();
    return parent::save($con);
  }

  private function setLogs() {
    if ($this->isNew())
      Damages_CarDamageLog::logEvent($this->getCarDamageId(), Damages_CarDamageLog::PATTERN_INVOICE_NEW, Damages_CarDamageLog::NAME_INVOICE);
    else if ($this->isModified())
      Damages_CarDamageLog::logEvent($this->getCarDamageId(), sprintf(Damages_CarDamageLog::PATTERN_INVOICE_MODIFIED, $this->getId()), Damages_CarDamageLog::NAME_INVOICE);
  }

}
